import contextlib


@contextlib.contextmanager
def sample():
    print('enter')
    yield {}
    print('exit')


if __name__ == '__main__':
    with sample() as f:
        print('processing')

"""
结果：
    enter
    processing
    exi
    
---->
"""
